package com.atguigu.gmallsuger.mapper;

import com.atguigu.gmallsuger.bean.KeyWord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/12/6 9:26
 */
public interface KeywordMap {
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(multiIf(source = 'search', 10, source = 'click', 6, source = 'order', 4, 2) * ct) AS score\n" +
        "FROM keyword_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n")
    List<KeyWord> kw(@Param("date") int date);
    
}
